use crate::ir::graph::Graph;

#[derive(Clone, Copy, Debug, Default)]
pub struct PassResult {
    pub changed: bool,
}

impl PassResult {
    #[inline]
    pub fn changed() -> Self {
        Self { changed: true }
    }
    #[inline]
    pub fn unchanged() -> Self {
        Self { changed: false }
    }
}

pub trait Pass {
    fn name(&self) -> &'static str;
    fn run(&mut self, g: &mut Graph) -> PassResult;
}
